package com.scope;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Xiongx
 * @version 1.0
 * @date 2021/6/28 4:32
 * @since JDK 1.8
 */
@RestController
@RequestMapping("scope")
public class ScopeController {

    @Autowired
    private ApplicationContext context;

    @Autowired
    private ScopeUtils scopeUtils;

    @Autowired
    private ScopeUtils2 scopeUtils2;

    @RequestMapping("test")
    public String test(){
        ScopeUtils exampleService =context.getBean(ScopeUtils.class);
        ScopeBean scopeBean=exampleService.getTestBean();
        System.out.println(scopeBean);
        return "jjjj";
    }

    @RequestMapping("test2")
    public String teswt(){
       ScopeBean scopeBean= scopeUtils.getTestBean2();
        System.out.println(scopeBean);
        return "jjjj22";
    }

    @RequestMapping("test3")
    public String test3(){
        ScopeBean scopeBean= scopeUtils2.getScopeBean();
        System.out.println(scopeBean);
        return "qqddqdqdqdq";
    }



}
